"use strict";
module.exports = {
  /**
   * 删除待办
   * @url client/todo/kh/deleteTodo.js 前端调用的url参数地址
   * data 请求参数
   * @param {String} params1  参数1
   */
  main: async (event) => {
    let { data = {}, userInfo, util, filterResponse, originalParam } = event;
    let { customUtil, uniID, config, pubFun, vk, db, _, $ } = util;
    let { uid } = data;
    // 业务逻辑开始-----------------------------------------------------------
    if (!data._id) return { code: -1, msg: "缺少待办ID" };
    const deleteResult = vk.baseDao.deleteById({
      dbName: "dfb-todo",
      id: data._id,
    });
    if (!deleteResult) return { code: -1, msg: "删除失败" };
    await vk.baseDao.del({
      dbName: "dfb-todo-process",
      whereJson: {
        todo_id: data._id,
      },
    });

    // 业务逻辑结束-----------------------------------------------------------
    return { code: 0, msg: "删除成功" };
  },
};
